BOINC_DIR="../boinc_trunk"
MYSQL_DIR="/usr/lib/mysql"
BOINC_LIBDIR="$BOINC_DIR/lib/.libs"
BOINC_SCHED="$BOINC_DIR/sched"
OTHERLIBS="-ldl $BOINC_SCHED/.libs/libsched.a /usr/lib/libmysqlclient.so -lpthread -lcrypt -lnsl -lm -lz $BOINC_LIBDIR/libboinc.a $BOINC_LIBDIR/libboinc_crypt.a -L/usr/local/lib -lboost_filesystem -lboost_system -lssl -lcrypto -Wl,-Bsymbolic-functions"

#Compile Assimilator
g++ -DHAVE_CONFIG_H  -fPIC -I$BOINC_DIR  -I$BOINC_DIR/lib -I$BOINC_DIR/api -I$BOINC_DIR/db -I$BOINC_DIR/sched -I$BOINC_DIR/tools -pthread -I/usr/include/mysql  -DBIG_JOINS=1  -fno-strict-aliasing -pthread  -O2 -c -o ppp_assimilator.o ppp_assimilator.cpp
#Link Assimilator
g++ -O2 $BOINC_SCHED/assimilator.o $BOINC_SCHED/validate_util.o ppp_assimilator.o $OTHERLIBS -o bin/ppp_assimilator


#Compile Validator
g++ -DHAVE_CONFIG_H -fPIC -I$BOINC_DIR  -I$BOINC_DIR/lib -I$BOINC_DIR/api -I$BOINC_DIR/db -I$BOINC_DIR/sched -I$BOINC_DIR/tools -pthread -I/usr/include/mysql  -DBIG_JOINS=1  -fno-strict-aliasing -pthread  -O2 -c -o ppp_validator.o ppp_validator.cpp
#Link Validator
g++ -O2 $BOINC_SCHED/credit.o $BOINC_SCHED/validator.o $BOINC_SCHED/validate_util.o $BOINC_SCHED/validate_util2.o ppp_validator.o  $OTHERLIBS -o bin/ppp_validator


#Compile Work Generator Wrapper
g++ -DHAVE_CONFIG_H  -fPIC -I$BOINC_DIR  -I$BOINC_DIR/lib -I$BOINC_DIR/api -I$BOINC_DIR/db -I$BOINC_DIR/sched -I$BOINC_DIR/tools -pthread -I/usr/include/mysql  -DBIG_JOINS=1  -fno-strict-aliasing -pthread  -O2 -c -o ppp_work_generator.o ppp_work_generator.cpp
g++ -O2 ppp_work_generator.o $OTHERLIBS -o bin/ppp_work_generator 

#Compile Work Generator Wrapper
g++ -DHAVE_CONFIG_H  -fPIC -I$BOINC_DIR  -I$BOINC_DIR/lib -I$BOINC_DIR/api -I$BOINC_DIR/db -I$BOINC_DIR/sched -I$BOINC_DIR/tools -pthread -I/usr/include/mysql  -DBIG_JOINS=1  -fno-strict-aliasing -pthread  -O2 -c -o pcl_work_generator.o pcl_work_generator.cpp
g++ -O2 pcl_work_generator.o $OTHERLIBS -o bin/pcl_work_generator 

cp bin/ppp_assimilator bin/pcl_assimilator
cp bin/ppp_validator bin/pcl_validator

rm *.o
